const init = {
  task: { content: '', assignments: [{ title: '', type: '' }] },
  assignments: [],
  taskContentRead: {},
  quizzes: []
}
export default (state = init, action) => {
  switch (action.type) {
    case 'REFRESH_TASK':
      return Object.assign({}, state, {task: action.taskInfo})
    case 'REFRESH_ASSIGNMENTS':
      return Object.assign({}, state, {assignments: action.assignments})
    case 'REFRESH_TASK_CONTENT_READ':
      return Object.assign({}, state, {taskContentRead: action.taskContentRead})
    case 'REFRESH_ASSIGNMENT_QUIZ':
      return Object.assign({}, state, { quizzes: action.quizzes })
    default:
      return state
  }
}
